import { ref } from 'vue'
import { getCommentsByArticle } from 'src/services/comment/'

const useComments = (slug: string) => {
  const comments = ref<ArticleComment[]>([])

  const fetchComments = async () => {
    comments.value = await getCommentsByArticle(slug)
  }

  fetchComments()

  return {
    comments
  }
}

export default useComments